import { asyncRoutes } from '@/router'
import { constantRoutes } from '@/router'
const state = {
  routers: []
}
const mutations = {
  setRouters(state, data) {
    // 重组右侧菜单栏显示 数组
    state.routers = [...constantRoutes, ...data]
  }
}
const actions = {
  filterRouter(store, data) {
    // console.log(asyncRoutes)
    const routers = asyncRoutes.filter(item => data.includes(item.name))
    store.commit('setRouters', routers)
    return routers
  }
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}

